<?php header('Content-type: text/xml; charset=utf-8'); ?>
<?php
    $d = array(
        array('child' => array('1', '2', '3'), 'name' => 'root'),
        array('child' => array('4', '5', '6'), 'name' => 'happy'),
        array('child' => array('7'), 'name' => 'today'),
        array('child' => array('8'), 'name' => 'yesterday'),
        array('child' => array('9'), 'name' => 'tommorrow'),
        array('child' => array(), 'name' => 'computer'),
        array('child' => array(), 'name' => 'system'),
        array('child' => array(), 'name' => 'engineering'),
        array('child' => array(), 'name' => 'test'),
        array('child' => array(), 'name' => 'unix')
    );
    
    $a = null;
    
    if (!empty($_POST['ele'])){
        $_POST['ele'] = intval($_POST['ele']);
        if ($_POST['ele'] < count($d))
            $a = &$d[$_POST['ele']];
        else
            $a = null;
    }
    else{
        $a = &$d[0];
    }

    if (!empty($a) && !empty($a['child'])){
        print '<ul>';
        foreach($a['child'] as $v){
            print '<li><a href="#" rel="' . $v . '" >' . $d[$v]['name'] . '</a></li>';
        }
        print '</ul>';
    }